package com.xzk.web;

import com.xzk.bean.Student;
import com.xzk.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Classname StudentController
 * @Description TODO
 * @Date 2020/9/20 19:12
 * @Created by ccc-j
 * @email ccc-ju@outlook.com
 */
@Controller
public class StudentController {

    @Autowired
    private StudentService studentService;

    //匹配请求，调取service方法
    @RequestMapping("/getAllStudents")
    public String getAll(ModelMap map){
        List<Student> students = studentService.getAll();
        map.addAttribute("students", students);
        return "show";
    }



}
